package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.clazz.AggsTypeClass;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 梁鲁江
 * @version v1.0
 * @date 2019/1/22 21:46
 * @since v1.0
 */
@Getter
public enum SwitchEnum {
    /**
     * 开关
     */
    ON("on", "enum.switch.name.on", 1),
    OFF("off", "enum.switch.name.off", 0)
    ;

    private String alias;
    private String name;
    private Integer value;

    SwitchEnum(String alias, String name, Integer value) {
        this.alias = alias;
        this.name = name;
        this.value = value;
    }

    public String getAlias() {
        return alias;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
    public static List<AggsTypeClass> list() {
        List<AggsTypeClass> list = new ArrayList<>();
        for (SwitchEnum cache : values()) {
            AggsTypeClass aggsTypeClass = new AggsTypeClass();
            aggsTypeClass.setAlias(cache.getAlias());
            aggsTypeClass.setName(cache.getName());
            list.add(aggsTypeClass);
        }
        return list;
    }
}
